﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DIProject.Dictionary
{
    public partial class AssessmentGroup : Form
    {
        public AssessmentGroup()
        {
            InitializeComponent();
        }

        private void AssessmentGroup_Load(object sender, EventArgs e)
        {
            InitAssessmentGroup();
        }
        private void InitAssessmentGroup()
        {
            // TODO: This line of code loads data into the 'dictionary.AssessmentGroup' table. You can move, or remove it, as needed.
            this.assessmentGroupTableAdapter.Fill(this.dictionary.AssessmentGroup);
            DIProject.Data.Sync.SetVisible(this.dictionary.AssessmentGroup);
            dataGridView1.DataSource = this.dictionary.AssessmentGroup.DefaultView;
        }

        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            dataGridView1.Rows[e.RowIndex].Selected = true;
            DataRowView dvr = dataGridView1.SelectedRows[0].DataBoundItem as DataRowView;
            if (dvr != null)
            {
                DataSets.Dictionary.AssessmentGroupRow ag = dvr.Row as DataSets.Dictionary.AssessmentGroupRow;
                if (ag != null)
                {
                    AssessmentGroupDetails agd = new AssessmentGroupDetails(DIProject.Util.ActionType.Update, ag.Id, this);
                    agd.ShowDialog(this);
                }
            }
            InitAssessmentGroup();
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            InitAssessmentGroup();
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            AssessmentGroupDetails agd = new AssessmentGroupDetails(DIProject.Util.ActionType.Insert, Int32.MinValue, this);
            agd.ShowDialog(this);
            InitAssessmentGroup();
        }
    }
}